<template>
    <div class="father">
        <h2>父组件</h2>
        <h3 v-if="childToy">我收到了玩具: {{ childToy }}</h3>
        <Child @get-toy="getToy" />
    </div>
</template>

<script setup lang="ts">
import Child from './Child.vue'
import { ref } from 'vue'
const childToy = ref('')
function getToy(toy: string) {
    childToy.value = toy
}
</script>

<style scoped>
.father {
    padding: 20px;
    background-color: rgb(165, 164, 164);
    border-radius: 10px;
}
</style>